<% form_for(ad_form,:html=>{:multipart=>true}) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name ,"广告标志名" %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :description  ,"广告描述"%><br />
    <%= f.text_field :description %>
  </p>
  <p>
    <%= f.label :style  ,"广告类型"%><br />
    <%= f.select :style_id,Style.all.collect{|p| [p.style_des,p.id]} %>
  </p>
  <p>
    <%= f.label :link  ,"链接"%><br />
    <%= f.text_field :link %>
  </p>
  <p>
    <%= f.label :content  ,"内容"%><br />
    <%= f.text_area :content %>
  </p>
  <p>
    <%= f.label :image_name  ,"图片"%><br />
    <%= f.file_field :image %>
    <%= image_tag ad_form.image_name ? "newsimgs/#{ad_form.image_name}":"noimage.png",:size=>"40x40" %>
  </p>
  <p>
    <%= f.label :height  ,"高度"%><br />
    <%= f.text_field :height %>
  </p>
  <p>
    <%= f.label :width  ,"宽度"%><br />
    <%= f.text_field :width %>
  </p>
  <p>
    <%= f.submit "提交" %>
  </p>
<% end %>